﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

namespace WFL.Office.Word
{
    public class WordTables
    {
        public WordTable this[int index]
        {
            get { return new WordTable(_tables[index]) { Document = Document }; }
        }

        public int Count
        {
            get { return _tables.Count; }
        }


        private Tables _tables;

        public WordDocument Document
        {
            get;
            internal set;
        }

        internal WordTables(Tables tables)
        {
            _tables = tables;
        }

        public WordTable Add(WordRange range, int numRows, int numColumns, DefaultTableBehavior defaultTableBehavior = DefaultTableBehavior.wdWord8TableBehavior, AutoFitBehavior autoFitBehavior = AutoFitBehavior.wdAutoFitFixed)
        {
            return new WordTable(_tables.Add(range._range, numRows, numColumns, defaultTableBehavior, autoFitBehavior)) { Document = Document };
        }

    }
}
